package com.xinhe.web.controller;

import com.querydsl.core.QueryResults;
import com.xinhe.web.common.Result;
import com.xinhe.web.entity.BankType;
import com.xinhe.web.service.BankTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(value = "银行信息", tags = {"银行信息"})
@RestController
@RequestMapping(value = {"/bankType"}, produces = {"application/json;charset=UTF-8"})

public class BankTypeController {
    @Autowired
    private BankTypeService bankTypeService;

    @ApiOperation(httpMethod = "GET", value = "分页查询")
    @RequestMapping({"/pageBankType"})
    QueryResults<BankType> pageBankType(String name, String value, String remark, int pageNum, int pageSize) {
        return this.bankTypeService.pageBankType(name, value, remark, pageNum,  pageSize);
    }

    @ApiOperation(httpMethod = "POST", value = "保存")
    @RequestMapping({"/saveBankType"})
    Result saveBankType(String name, String value, String remark) {
        this.bankTypeService.saveModel(name, value, remark);
        return Result.ok();
    }
    @ApiOperation(httpMethod = "GET", value = "删除")
    @ApiImplicitParam(name = "bankTypeId", value = "标识", required = true)
    @RequestMapping({"/deleteBankType"})
    public Result deleteBankType(Long bankTypeId) {
        this.bankTypeService.delete(bankTypeId);
        return Result.ok();
    }

    @ApiOperation(httpMethod = "GET", value = "查询详情")
    @ApiImplicitParam(name = "bankTypeId", value = "标识", required = true)
    @RequestMapping({"/detailBankType"})
    public Result<BankType> detailBankType(Long bankTypeId) {
        return this.bankTypeService.findById(bankTypeId);
      }
}
